--LuP: naplneni tridy 1260198,10 "Identifikační prvky" (SPUSTIT)
<g>
<a>
  --Identifikacni prvky pristupu a dochazky
insert into a1260198u10 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a17811u10218 as A
left outer join a1260198u10 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</a>
<p>
  --Identifikacni prvky pristupu a dochazky
insert into a1260198u10 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a17811u10218 as A
left outer join a1260198u10 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</p>
</g>

--LuP: naplneni tridy 88858,10 "Evidovane statky" (SPUSTIT)
<g>
<a>
  --Registracni znacky silnicnich vozidel
insert into a88858u10 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a372245u10212 as A
left outer join a88858u10 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</a>
<p>
  --Registracni znacky silnicnich vozidel
insert into a88858u10 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a372245u10212 as A
left outer join a88858u10 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</p>
</g>

--LuP: naplneni tridy 145,9 "Konkretni vyskyty statku" (SPUSTIT)
<g>
<a>
  --Certifikaty, osvedceni
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a2696505u10 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Vstupenky
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a369496u10152 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Statky spravy prostoru
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a5019u10015 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Casti energeticke soustavy
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a226429u10103 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Kusy konkretnich statku
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a2020306u11241 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Evidovane statky
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a88858u10 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Zarizeni sledovana v doprave
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a231041u10212 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Zarizeni servisovana
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a9373u10 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Vyskyty produktu dle vazby Rozpad statku dle RA
insert into a145u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a131u0 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
join a227959u10 as B on (B.ic_b = A.ic and B.u_b = A.u)
join a133u0 as C on (C.ic = B.ic_a and C.u = B.u_a)
where (W.ic is null and W.u is null)
</a>
<p>
  --Certifikaty, osvedceni
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a2696505u10 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Vstupenky
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a369496u10152 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Statky spravy prostoru
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a5019u10015 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Casti energeticke soustavy
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a226429u10103 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Kusy konkretnich statku
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a2020306u11241 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Evidovane statky
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a88858u10 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Zarizeni sledovana v doprave
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a231041u10212 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Zarizeni servisovana
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a9373u10 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Vyskyty produktu dle vazby Rozpad statku dle RA
insert into a145u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a131u0 as A
left outer join a145u9 as W on (W.ic = A.ic and W.u = A.u)
join a227959u10 as B on (B.ic_b = A.ic and B.u_b = A.u)
join a133u0 as C on (C.ic = B.ic_a and C.u = B.u_a)
where (W.ic is null and W.u is null)
</p>
</g>

--LuP: naplneni tridy 149,9 "Ostatni vyskyty statku" (SPUSTIT)
<g>
<a>
  --Verze dokumentu DMS
insert into a149u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a12542793u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Evidovane vytisky
insert into a149u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a13316759u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Webove stranky
insert into a149u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a29510161u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Licence informacniho systemu
insert into a149u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a291816u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Rozpadovy atribut zvirete pro sklady
insert into a149u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a1049202u10016 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Objekty manipulacnich jednotek
insert into a149u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a30610972u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</a>
<p>
  --Verze dokumentu DMS
insert into a149u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a12542793u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Evidovane vytisky
insert into a149u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a13316759u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Webove stranky
insert into a149u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a29510161u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Licence informacniho systemu
insert into a149u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a291816u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Rozpadovy atribut zvirete pro sklady
insert into a149u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a1049202u10016 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Objekty manipulacnich jednotek
insert into a149u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a30610972u10 as A
left outer join a149u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</p>
</g>

--LuP: naplneni tridy 144,9 "Vyskyty statku" (SPUSTIT)
<g>
<a>
insert into a144u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a145u9 as A
left outer join a144u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)

insert into a144u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a149u9 as A
left outer join a144u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</a>
<p>
insert into a144u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a145u9 as A
left outer join a144u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)

insert into a144u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a149u9 as A
left outer join a144u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</p>
</g>

--LuP: naplneni tridy 133,0 "Produkty" (SPUSTIT)
<g>
<a>
  --Priciny neshod
insert into a133u0 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a10223139u10 as A
left outer join a133u0 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Moduly informacniho systemu
insert into a133u0 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a8157062u10 as A
left outer join a133u0 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Typy neshod a odchylek
insert into a133u0 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a594205u10 as A
left outer join a133u0 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</a>
<p>
  --Priciny neshod
insert into a133u0 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a10223139u10 as A
left outer join a133u0 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Moduly informacniho systemu
insert into a133u0 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a8157062u10 as A
left outer join a133u0 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Typy neshod a odchylek
insert into a133u0 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a594205u10 as A
left outer join a133u0 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</p>
</g>

--LuP: naplneni tridy 139,9 "Ostatni produkty" (SPUSTIT)
<g>
<a>
  --Priciny neshod
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a10223139u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Moduly informacniho systemu
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a8157062u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Slozky obalu
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a960933u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Znalostni baze
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a83257u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Navodky
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a213134u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Mapy, plany
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a3367u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Programove funkce
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a105u0 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --xProgramove funkce
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a80u0 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Normy pro evidenci zvirat - zakladni
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a766561u10016 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Kategorie zvirat
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a332417u10016 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Distribuovane balicky dat
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a2164u0 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Smernice
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a9976u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Obecny katalog roli a profesi
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a3009u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Typy neshod a odchylek
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a594205u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Definice procesu
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a3435u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Technologie
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a195739u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Obchodni jednotky software
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a93542u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Katalog objektu manipulacnich jednotek
insert into a139u9 (ic, u, useric, useru, ts0, langstate, sstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1, A.sstate
from a30640952u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</a>
<p>
  --Priciny neshod
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a10223139u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Moduly informacniho systemu
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a8157062u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Slozky obalu
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a960933u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Znalostni baze
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a83257u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Navodky
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a213134u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Mapy, plany
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a3367u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Programove funkce
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a105u0 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --xProgramove funkce
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a80u0 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Normy pro evidenci zvirat - zakladni
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a766561u10016 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Kategorie zvirat
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a332417u10016 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Distribuovane balicky dat
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a2164u0 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Smernice
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a9976u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Obecny katalog roli a profesi
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a3009u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Typy neshod a odchylek
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a594205u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Definice procesu
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a3435u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Technologie
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a195739u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Obchodni jednotky software
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a93542u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
  --Katalog objektu manipulacnich jednotek
insert into a139u9 (ic, u, useric, useru, ts0, langstate)
select A.ic, A.u, A.useric, A.useru, A.ts0, 1
from a30640952u10 as A
left outer join a139u9 as W on (W.ic = A.ic and W.u = A.u)
where (W.ic is null and W.u is null)
</p>
</g>

--PEM: PĹ™esun ATR VyĹ™azeno - SPUSTIT pĹ™ed reinstalacĂ­ na global DB (9, VG, VGU,..) restart AS
<g>
create procedure dbo.ChangeAttrClass(@AttrIC bigint, @AttrU int, @OClassIC bigint, @OClassU int, @NClassIC bigint, @NClassU int) as
begin
  if exists(select * from a103u0 where (ic_a = @OClassIC) and (u_a = @OClassU) and (ic_b = @AttrIC) and (u_b = @AttrU))
  begin
	declare @attrname nvarchar(50)
	set @attrname = 'a' + convert(nvarchar(30),@AttrIC) + 'u' + convert(nvarchar(20),@AttrU)
	declare @oclassname nvarchar(50)
	set @oclassname = 'a' + convert(nvarchar(30),@OClassIC) + 'u' + convert(nvarchar(20),@OClassU)
	declare @nclassname nvarchar(50)
	set @nclassname = 'a' + convert(nvarchar(30),@NClassIC) + 'u' + convert(nvarchar(20),@NClassU)

	declare @attrtype smallint
	declare @attrprec smallint
	declare @attrcollation nvarchar(50)
	declare @islangattr bit
	declare @langsuffix nvarchar(100)
	declare @fullattrname nvarchar(100)
	declare @attrtypename nvarchar(100)

	select @islangattr = case when a222u0 in (2,9,13) then 1 else 0 end from a102u0 where ic = @AttrIC and u = @AttrU

	if (@islangattr = 1)
	begin
	    declare langs scroll cursor for select 'l' + convert(nvarchar(30),ic) + 'u' + convert(nvarchar(20),u) from a194u0
		open langs
		fetch first from langs into @langsuffix
		while (@@fetch_status = 0)
		begin
		  set @fullattrname = @attrname + @langsuffix

		  select @attrtype = xusertype,@attrprec = prec,@attrcollation = collation from syscolumns where name = @fullattrname		  
		  if (@attrtype = 231) and (@attrprec = -1) set @attrtypename = 'nvarchar(max)' else
		  if (@attrtype = 231) and (@attrprec <> -1) set @attrtypename = 'nvarchar(' + convert(nvarchar(10),@attrprec) + ')' else
		  if (@attrtype = 48) set @attrtypename = 'tinyint' else 
		  if (@attrtype = 52) set @attrtypename = 'smallint' else
		  if (@attrtype = 56) set @attrtypename = 'integer' else
		  if (@attrtype = 127) set @attrtypename = 'bigint' else
		  if (@attrtype = 62) set @attrtypename = 'float' else
		  if (@attrtype = 61) set @attrtypename = 'datetime' else
		  if (@attrtype = 165) set @attrtypename = 'varbinary(max)'

		if (@attrcollation is not null) 
		  exec('alter table ' + @nclassname + ' add ' + @fullattrname + ' ' + @attrtypename + ' collate ' + @attrcollation) else
		  exec('alter table ' + @nclassname + ' add ' + @fullattrname + ' ' + @attrtypename)
		exec('update a set ' + @fullattrname + ' = b.' + @fullattrname + ' from ' + @nclassname + ' as a join ' + @oclassname + ' as b on (a.ic = b.ic) and (a.u = b.u)')
		if exists(select * from sysindexes where name = 'i_' + @fullattrname)
		begin
		  exec('drop index ' + @oclassname + '.i_' + @fullattrname)
		  exec('create index i_' + @fullattrname + ' on ' + @nclassname + '(' + @fullattrname + ')')
		end
		exec('alter table ' + @oclassname + ' drop column ' + @fullattrname)  
		  fetch next from langs into @langsuffix
        end
        close langs
        deallocate langs
	end
	else
	begin	
		select @attrtype = xusertype,@attrprec = prec,@attrcollation = collation from syscolumns where name = @attrname
		
		if (@attrtype = 231) and (@attrprec = -1) set @attrtypename = 'nvarchar(max)' else
		if (@attrtype = 231) and (@attrprec <> -1) set @attrtypename = 'nvarchar(' + convert(nvarchar(10),@attrprec) + ')' else
		if (@attrtype = 48) set @attrtypename = 'tinyint' else 
		if (@attrtype = 52) set @attrtypename = 'smallint' else
		if (@attrtype = 56) set @attrtypename = 'integer' else
		if (@attrtype = 127) set @attrtypename = 'bigint' else
		if (@attrtype = 62) set @attrtypename = 'float' else
		if (@attrtype = 61) set @attrtypename = 'datetime' else
		if (@attrtype = 165) set @attrtypename = 'varbinary(max)'

		if (@attrcollation is not null) 
		  exec('alter table ' + @nclassname + ' add ' + @attrname + ' ' + @attrtypename + ' collate ' + @attrcollation) else
		  exec('alter table ' + @nclassname + ' add ' + @attrname + ' ' + @attrtypename)
		exec('update a set ' + @attrname + ' = b.' + @attrname + ' from ' + @nclassname + ' as a join ' + @oclassname + ' as b on (a.ic = b.ic) and (a.u = b.u)')
		if exists(select * from sysindexes where name = 'i_' + @attrname)
		begin
		  exec('drop index ' + @oclassname + '.i_' + @attrname)
		  exec('create index i_' + @attrname + ' on ' + @nclassname + '(' + @attrname + ')')
		end
		exec('alter table ' + @oclassname + ' drop column ' + @attrname)  
    end

	update a103u0 set ic_a = @NClassIC, u_a = @NClassU where ic_b = @AttrIC and u_b = @AttrU
  end
end
</g>

<g>
exec ChangeAttrClass 282033,10,3460,10,133,0;
</g>

<g>
drop procedure ChangeAttrClass
</g>



--MP: BezpeÄŤnostnĂ­ klĂ­ÄŤ statku - SPUSTIT pĹ™ed reinstalacĂ­ na global DB (9, VG, VGU,..) restart AS
-- not support system attributes (exception is missing)
<g>
create procedure dbo.ChangeAttrClass(@AttrIC bigint, @AttrU int, @OClassIC bigint, @OClassU int, @NClassIC bigint, @NClassU int) as
begin
  if exists(select * from a103u0 where (ic_a = @OClassIC) and (u_a = @OClassU) and (ic_b = @AttrIC) and (u_b = @AttrU))
  begin
       declare @attrname nvarchar(50)
       set @attrname = 'a' + convert(nvarchar(30),@AttrIC) + 'u' + convert(nvarchar(20),@AttrU)
       declare @oclassname nvarchar(50)
       set @oclassname = 'a' + convert(nvarchar(30),@OClassIC) + 'u' + convert(nvarchar(20),@OClassU)
       declare @nclassname nvarchar(50)
       set @nclassname = 'a' + convert(nvarchar(30),@NClassIC) + 'u' + convert(nvarchar(20),@NClassU)

       declare @attrtype smallint
       declare @attrprec smallint
       declare @attrcollation nvarchar(50)
       declare @islangattr bit
       declare @langsuffix nvarchar(100)
       declare @fullattrname nvarchar(100)
       declare @attrtypename nvarchar(100)

       select @islangattr = case when a222u0 in (2,9,13) then 1 else 0 end from a102u0 where ic = @AttrIC and u = @AttrU

       if (@islangattr = 1)
       begin
           declare langs scroll cursor for select 'l' + convert(nvarchar(30),ic) + 'u' + convert(nvarchar(20),u) from a194u0
             open langs
             fetch first from langs into @langsuffix
             while (@@fetch_status = 0)
             begin
               set @fullattrname = @attrname + @langsuffix

               select @attrtype = xusertype,@attrprec = prec,@attrcollation = collation from syscolumns where name = @fullattrname            
               if (@attrtype = 231) and (@attrprec = -1) set @attrtypename = 'nvarchar(max)' else
               if (@attrtype = 231) and (@attrprec <> -1) set @attrtypename = 'nvarchar(' + convert(nvarchar(10),@attrprec) + ')' else
               if (@attrtype = 48) set @attrtypename = 'tinyint' else 
               if (@attrtype = 52) set @attrtypename = 'smallint' else
               if (@attrtype = 56) set @attrtypename = 'integer' else
               if (@attrtype = 127) set @attrtypename = 'bigint' else
               if (@attrtype = 62) set @attrtypename = 'float' else
               if (@attrtype = 61) set @attrtypename = 'datetime' else
               if (@attrtype = 165) set @attrtypename = 'varbinary(max)'

             if (@attrcollation is not null) 
               exec('alter table ' + @nclassname + ' add ' + @fullattrname + ' ' + @attrtypename + ' collate ' + @attrcollation) else
               exec('alter table ' + @nclassname + ' add ' + @fullattrname + ' ' + @attrtypename)
             exec('update a set ' + @fullattrname + ' = b.' + @fullattrname + ' from ' + @nclassname + ' as a join ' + @oclassname + ' as b on (a.ic = b.ic) and (a.u = b.u)')
             if exists(select * from sysindexes where name = 'i_' + @fullattrname)
             begin
               exec('drop index ' + @oclassname + '.i_' + @fullattrname)
               exec('create index i_' + @fullattrname + ' on ' + @nclassname + '(' + @fullattrname + ')')
             end
             exec('alter table ' + @oclassname + ' drop column ' + @fullattrname)  
               fetch next from langs into @langsuffix
        end
        close langs
        deallocate langs
       end
       else
       begin  
             select @attrtype = xusertype,@attrprec = prec,@attrcollation = collation from syscolumns where name = @attrname
             
             if (@attrtype = 231) and (@attrprec = -1) set @attrtypename = 'nvarchar(max)' else
             if (@attrtype = 231) and (@attrprec <> -1) set @attrtypename = 'nvarchar(' + convert(nvarchar(10),@attrprec) + ')' else
             if (@attrtype = 48) set @attrtypename = 'tinyint' else 
             if (@attrtype = 52) set @attrtypename = 'smallint' else
             if (@attrtype = 56) set @attrtypename = 'integer' else
             if (@attrtype = 127) set @attrtypename = 'bigint' else
             if (@attrtype = 62) set @attrtypename = 'float' else
             if (@attrtype = 61) set @attrtypename = 'datetime' else
             if (@attrtype = 165) set @attrtypename = 'varbinary(max)'

             if (@attrcollation is not null) 
               exec('alter table ' + @nclassname + ' add ' + @attrname + ' ' + @attrtypename + ' collate ' + @attrcollation) else
               exec('alter table ' + @nclassname + ' add ' + @attrname + ' ' + @attrtypename)
             exec('update a set ' + @attrname + ' = b.' + @attrname + ' from ' + @nclassname + ' as a join ' + @oclassname + ' as b on (a.ic = b.ic) and (a.u = b.u)')
             if exists(select * from sysindexes where name = 'i_' + @attrname)
             begin
               exec('drop index ' + @oclassname + '.i_' + @attrname)
               exec('create index i_' + @attrname + ' on ' + @nclassname + '(' + @attrname + ')')
             end
             exec('alter table ' + @oclassname + ' drop column ' + @attrname)  
    end

       update a103u0 set ic_a = @NClassIC, u_a = @NClassU where ic_b = @AttrIC and u_b = @AttrU
  end
end
</g>



<g>
exec ChangeAttrClass 29618467,10, 88858,10, 131,0;
</g>

<g>
drop procedure ChangeAttrClass
</g>

<g>
update a set a29618467u10 = a29618465u10 from a131u0 as a join a5944000u10 as b on a.ic = b.ic and a.u = b.u
</g>







